HYPERCALL(event_channel_op),
HYPERCALL(sched_op),
HYPERCALL(set_timer_op),
- HYPERCALL(hvm_op)
+ HYPERCALL(hvm_op),
+ HYPERCALL(tmem_op)
};
#else /* defined(__x86_64__) */
HYPERCALL(event_channel_op),
HYPERCALL(sched_op),
HYPERCALL(set_timer_op),
- HYPERCALL(hvm_op)
+ HYPERCALL(hvm_op),
+ HYPERCALL(tmem_op)
};
static hvm_hypercall_t *hvm_hypercall32_table[NR_hypercalls] = {
HYPERCALL(event_channel_op),
HYPERCALL(sched_op),
HYPERCALL(set_timer_op),
- HYPERCALL(hvm_op)
+ HYPERCALL(hvm_op),
+ HYPERCALL(tmem_op)
};
#endif /* defined(__x86_64__) */
pgp_free_data(pgp, pool);
if ( ( pgp->pfp = tmem_page_alloc(pool) ) == NULL )
goto failed_dup;
+ pgp->size = 0;
/* tmh_copy_from_client properly handles len==0 and offsets != 0 */
ret = tmh_copy_from_client(pgp->pfp,cmfn,tmem_offset,pfn_offset,len,0);
if ( ret == -EFAULT )
if ( pcd_associate(pgp,NULL,0) == -ENOMEM )
goto failed_dup;
}
- pgp->size = 0;
done:
/* successfully replaced data, clean up and return success */
bad_copy:
/* this should only happen if the client passed a bad mfn */
failed_copies++;
-ASSERT(0);
- return -EFAULT;
+ ret = -EFAULT;
+ goto cleanup;
failed_dup:
/* couldn't change out the data, flush the old data and return
* -ENOSPC instead of -ENOMEM to differentiate failed _dup_ put */
+ ret = -ENOSPC;
+cleanup:
pgpfound = pgp_delete_from_obj(obj, pgp->index);
ASSERT(pgpfound == pgp);
pgp_delete(pgpfound,0);
tmem_spin_unlock(&obj->obj_spinlock);
}
pool->dup_puts_flushed++;
- return -ENOSPC;
+ return ret;
}
goto free;
ASSERT(ret != -EEXIST);
pgp->index = index;
+ pgp->size = 0;
if ( len != 0 && client->compress )
{
if ( pcd_associate(pgp,NULL,0) == -ENOMEM )
goto delete_and_free;
}
- pgp->size = 0;
insert_page:
if ( is_ephemeral(pool) )
tot_good_eph_puts++;
return 1;
+bad_copy:
+ /* this should only happen if the client passed a bad mfn */
+ ret = -EFAULT;
+ failed_copies++;
+
delete_and_free:
ASSERT((obj != NULL) && (pgp != NULL) && (pgp->index != -1));
pgpdel = pgp_delete_from_obj(obj, pgp->index);
}
pool->no_mem_puts++;
return ret;
-
-bad_copy:
- /* this should only happen if the client passed a bad mfn */
- failed_copies++;
-ASSERT(0);
- goto free;
}
static NOINLINE int do_tmem_get(pool_t *pool, uint64_t oid, uint32_t index,
bad_copy:
/* this should only happen if the client passed a bad mfn */
failed_copies++;
-ASSERT(0);
return -EFAULT;
}
static inline int tmh_get_tmemop_from_client(tmem_op_t *op, tmem_cli_op_t uops)
{
#ifdef CONFIG_COMPAT
- if ( is_pv_32on64_vcpu(current) )
+ if ( is_hvm_vcpu(current) ?
+ hvm_guest_x86_mode(current) != 8 :
+ is_pv_32on64_vcpu(current) )
{
int rc;
enum XLAT_tmem_op_u u;